/*
 * uuid.cpp
 *
 *  Created on: Jun 29, 2012
 *      Author: bjames
 */

/*******************************************************************************
 ** Government Sanctioned Espionage RPG Server                                **
 ** http://www.government-sanctioned.us/                                      **
 **===========================================================================**
 ** Name: uuid.cpp                                                            **
 ** Description: Global UUID Support                                          **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the LICENSE file within             **
 ** this distribution or at $WIKI/display/GOVT/License-software.              **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $GAME_DIR/LICENSE.                   **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 ** Copyright (c) 2009-2012  Barry Gian James <gian@gamingods.net>            **
 ** All rights reserved.                                                      **
 ******************************************************************************/
// $HeadURL$
// Modified $Date$ by $Author$
// $Id$
#include <boost/lexical_cast.hpp>
#include <boost/uuid/uuid_io.hpp>
#include "uuid.hpp"

namespace global
{


boost::uuids::uuid
UUIDFactory::StringToUUID(const std::string & u)
{
	return boost::lexical_cast<boost::uuids::uuid>(u);
}

std::string
UUIDFactory::Create()
{
    boost::uuids::random_generator gen;
    boost::uuids::uuid u = gen();
    return boost::uuids::to_string(u);
}
}	/* namespace global */

// Moved from using ID to using UUID for uniqueness tests 5.12.11 -gian
bool operator < (boost::uuids::uuid & a, boost::uuids::uuid & b)
{
//    return a.ID() < b.ID();
	return a < b;
}

// Not sure if this should compare object ID's or string compare names?
bool operator == (boost::uuids::uuid & a, boost::uuids::uuid & b)
{
//    return a.ID() == b.ID();
	return a == b;
}

